feat: handle retrying requests when rate limit exceeded#60
Draft
ahal wants to merge 1 commit intomozilla-releng:mainfrom
Draft
feat: handle retrying requests when rate limit exceeded#60ahal wants to merge 1 commit intomozilla-releng:mainfrom
ahal wants to merge 1 commit intomozilla-releng:mainfrom
Conversation
Following Github's recommended practices for both the GraphQL and REST APIs. Issue: mozilla-releng#20
ace209f to
4bb9164
Compare
jcristau
reviewed
May 22, 2025
Contributor
jcristau
left a comment
There was a problem hiding this comment.
Very cool, thanks for doing this.
Comment on lines
+73
to
+75
| wait_time = max(0, int(reset) - int(time())) | ||
| elif retry_after: | ||
| wait_time = int(retry_after) |
Contributor
There was a problem hiding this comment.
handle ValueError from the casts?
| while True: | ||
| with session.request(method, url, **kwargs) as resp: | ||
| if attempt <= self.MAX_RETRIES and is_rate_limited(resp): | ||
| time.sleep(get_wait_time(resp, attempt)) |
Contributor
There was a problem hiding this comment.
we might want to log something before sleep?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Following Github's recommended practices for both the GraphQL and REST APIs.
Issue: #20